
import { SheetManager } from "../../ccc3-framework-core/framework/modules/sheetManager";
import { Debug } from "../../ccc3-framework-core/utils/Debug";
import { ConfigDataBase } from "./Sheets";

export class ConfigData extends ConfigDataBase {

    public static init() {
        let self = this as any
        var obj: any = SheetManager.getList("ConfigData");
        Debug.log('ConfigData', obj)
        var vo: ConfigData | null = null!;
        for (var key in obj) {
            key != "keys" && (vo = ConfigData.get(key));
            vo && (self[vo.name] = vo.value, vo = null); 
        }
    }
    //id索引
    public static get(id: any) {
        let self = this as any
        if (self[id]) return self[id];
        return SheetManager.get("ConfigData", id, ConfigData);
    }
}